package com.lz.gmall.order.rpc;

import com.lz.gmall.common.result.Result;
import com.lz.gmall.order.biz.OrderBizService;
import com.lz.gmall.order.entity.OrderInfo;
import com.lz.gmall.order.vo.OrderConfirmVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 郭运龙
 */
@RestController
@RequestMapping("/api/inner/order")
public class OrderRpcController {

    @Autowired
    private OrderBizService orderBizService;

    /**
     * 远程调用接口，获取生成顶单商品的配置信息
     * @return
     */
    @GetMapping("/getOrderConfirm")
    public Result<OrderConfirmVo> getOrderConfirm(){
        OrderConfirmVo orderConfirmVo = orderBizService.getOrderConfirm();
        return Result.ok(orderConfirmVo);
    }

    /**
     * 远程调用，传过来订单id，查询订单数据
     * @param orderId
     * @return
     */
    @GetMapping("/getPayOrder/{orderId}")
    public Result<OrderInfo> getPayOrder(@PathVariable("orderId") String orderId){
        OrderInfo orderInfo = orderBizService.getPayOrder(orderId);
        return Result.ok(orderInfo);
    }
}
